package com.itheima.dao;

import com.itheima.domain.UserAccount;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.Date;
import java.util.List;

public interface AccountDao {
    @Select("select id, username, gender, idcard, from_address, to_address, start_time from tb_trip;")
    List<UserAccount> queryallinfo();

    @Select("select id, username, gender, idcard, from_address, to_address, start_time from tb_trip where tb_trip.id=#{id};")
    UserAccount findById(Integer id);

    @Update("update tb_trip set from_address=#{startAddr},to_address=#{toAddr} where id=#{id};")
    int updateById(@Param("id") Integer id, @Param("startAddr") String startAddr, @Param("toAddr") String toAddr);

    @Delete("delete from tb_trip where id=#{id} ")
    int deleteByid(@Param("id") Integer id);
}
